﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace weighing
{
    public class BillDeleteVisiblityConverter : System.Windows.Data.IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int status = (int)value;
            if (App.CurrentUser == null) { return System.Windows.Visibility.Collapsed; }
            if (status == 0 && (App.CurrentUser.roleType == (int)UserRoleType.WeighingManager || App.CurrentUser.roleType ==(int) UserRoleType.Developer)) {
                return System.Windows.Visibility.Visible;
            }
            else
            {
                return System.Windows.Visibility.Collapsed;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
